//
//  XWDeviceHelper.swift
//  XWClassroom
//
//  Created by xianquan on 2023/11/27.
//

import UIKit
import HandyJSON
import YYCategories

public class XWDeviceHelper: NSObject {
    
    struct DeviceType: HandyJSON {
        let name = ""
        let identifier = ""
    }
    
    static public func loadDeviceName(){
        let name = getDeviceName()
        if !name.isEmpty {
            return
        }
//        NetworkRequest<[DeviceType]>.request(networkType: .deviceName) { result in
//            switch result {
//            case .success(let response):
//                guard let response = response else {
//                    return
//                }
//                let model = UIDevice.current.machineModel
//                for item in response {
//                    if item.identifier == model{
//                        
//                        UserDefaults.DeviceModule.set(value: item.name, forKey: .deviceName)
//                    }
//                }
//            case .failure(let error):
//                XWLog(value: "获取设备型号失败：\(error)")
//            }
//        }
    }
    
    @objc public static func getDeviceName() -> String {
        return UserDefaults.DeviceModule.string(forKey: .deviceName) ?? ""
    }
}
